package com.dongjiantong.farmrecords.service;

import com.dongjiantong.common.web.sso.LoginInfo;
import com.dongjiantong.farmrecords.dto.RetailRecordsImmunizationDto;
import com.dongjiantong.farmrecords.model.FarmRecordsRetailImmunization;
import com.dongjiantong.mybatis.BaseService;
import com.github.pagehelper.PageInfo;

import java.util.List;
import java.util.Map;

/**
 * @author Lee
 * @date 2018/1/14
 */
public interface FarmRecordsRetailImmunizationService extends BaseService<FarmRecordsRetailImmunization> {
    /**
     * 养殖端分页查询
     * @param pageNum
     * @param pageSize
     * @param status
     * @param farmId
     * @return
     */
    PageInfo<FarmRecordsRetailImmunization> selectListByStatus(Integer pageNum, Integer pageSize, Integer status, Long farmId);

    /**
     * 政府端分页查询
     * @param pageNum
     * @param pageSize
     * @param map
     * @return
     */
    PageInfo<FarmRecordsRetailImmunization> selectByMap(Integer pageNum, Integer pageSize, Map map);

    /**
     * 根据主表id 查询(包含子表信息)
     * @param id
     * @return
     */
    RetailRecordsImmunizationDto selectById(Long id);

    /**
     * 创建一单免疫记录 (返回主表id和子表id)
     * @param loginInfo
     * @param retailRecordsImmunizationDto
     * @param toStatus
     * @return
     */
    Map<String,Object> createOne(LoginInfo loginInfo, RetailRecordsImmunizationDto retailRecordsImmunizationDto, Integer toStatus);

    /**
     * 正常更新免疫记录(免疫主表 免疫子表)
     * @param loginInfo
     * @param toStatus
     * @return
     */
    Integer updateByIdOrNumber(LoginInfo loginInfo, RetailRecordsImmunizationDto retailRecordsImmunizationDto, Integer toStatus);

    /**
     * 更新免疫记录(只更新免疫记录主表 耳标)
     * @param loginInfo
     * @param farmRecordsRetailImmunization
     * @param original_ear_list
     * @return
     */
    Boolean updateEarNumber(LoginInfo loginInfo, FarmRecordsRetailImmunization farmRecordsRetailImmunization, List<String> original_ear_list);
}
